/**
 * 
 */
package org.swing.utility.common.io;

import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;

/**
 * @author lqnhu
 *
 */
public final class GZOut extends GZIPOutputStream {
	/**
	 * Creates a new output stream with the specified buffer size.
	 *
	 * @param out
	 *            the output stream
	 * @param buffer
	 *            the output buffer size
	 * @param compression
	 *            Deflater compression level
	 * @throws java.io.IOException
	 *             If an I/O error has occurred.
	 * @throws IllegalArgumentException
	 *             if size is <= 0
	 */
	public GZOut(OutputStream out, int buffer, int compression)
			throws IOException {
		super(out, buffer);
		setLevel(compression);
	}

	/**
	 * Change the compression level.
	 * 
	 * @param newLevel
	 *            new compression level to use
	 */
	public void setLevel(int newLevel) {
		def.setLevel(newLevel);
	}
}


